import libtcodpy as libtcod

import config
import datetime

import events

if config.__PYSKILLER_DEBUG:
	NIGHT_DEBUG = True
	TIME_MULTIPLY = config.__PYSKILLER_TIME_MULTIPY_DEV
else:
	NIGHT_DEBUG = False
	TIME_MULTIPLY = config.__PYSKILLER_TIME_MULTIPY
#~ 
#~ class sk_timer(datetime.datetime):
	#~ def __init(self):
		#~ super(sk_timer,self).__init__(1986,2,3)
		#~ #pass
#~ 
	#~ def tick(self):
		#~ self = self + datetime.timedelta(0,60000*5*1)
#~ 
class sk_timer(events.EventListener):
	def __init__(self):
		if not NIGHT_DEBUG:
			self.__timer = datetime.datetime(1986,2,3, 
				libtcod.random_get_int(0,0,23),
				libtcod.random_get_int(0,0,59))
		else:
			self.__timer = datetime.datetime(1986,2,3)
		

	def tick(self):
		self.__timer = self.__timer + datetime.timedelta(0,60*5*TIME_MULTIPLY)

	def get_time(self):
		return self.__timer


	def is_night(self):
		return ( self.__timer.hour > 21 or self.__timer.hour < 7)
		
